package com.huc.controller;

import com.huc.entity.UserDO;
import com.huc.query.UserQuery;
import com.huc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("getUserInfo")
    public UserDO getUserInfo(String username){
        UserQuery userQuery = new UserQuery();
        userQuery.setUsername(username);
        return userService.getUserByName(userQuery);
    }

    @RequestMapping("reg")
    public String reg(@RequestBody UserDO userDO){
        return userService.adUser(userDO);
    }



}
